<%@page import="news.*"%>
<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>

	<head>
		<base href="<%=basePath%>">
		<meta http-equiv="Content-Type" content="text/html;charset=gbk" />
		<title>新闻中国</title>
		<link href="css/main.css" rel="stylesheet" type="text/css" />

		<script language="javascript">
			function check() {
				var login_username = document.getElementById("uname");
				var login_password = document.getElementById("upwd");
				if(login_username.value == "") {
					alert("用户名不能为空！请重新填入！");
					login_username.focus();
					return false;
				} else if(login_password.value == "") {
					alert("密码不能为空！请重新填入！");
					login_password.focus();
					return false;
				}
				return true;
			}

			function focusOnLogin() {
				var login_username = document.getElementById("uname");
				login_username.focus();
			}
		</script>

		<script src="js/jquery-1.12.4.js"></script>

	</head>

	<body onload="focusOnLogin()">
		<div id="header">
		<c:choose>
			<c:when test="${not empty sessionScope.LOGIN}">
				<div id="admin_bar">
					<div id="status">
						管理员：${sessionScope.LOGIN.uname} 登录 &#160;&#160;&#160;&#160;
						<a href="dologinout.jsp">login out</a>&#160;&#160;&#160;&#160;
						<a href="modifynews.jsp">管理后台</a>
					</div>
					<div id="channel"> </div>
				</div>
			</c:when>
			<c:otherwise>
				<div id="top_login">
					<form action="login" method="post" onsubmit="return check()">
						<label> 登录名 </label>
						<input type="text" name="uname" id="uname" class="login_input" />
						<label> 密&#160;&#160;码 </label>
						<input type="password" name="upwd" id="upwd" class="login_input" />
						<input type="submit" class="login_sub" value="登录" />
						<input type="checkbox" name="keep" value="1" />记住我的登录状态
						<label id="error"> </label>
						<img src="images/friend_logo.gif" alt="Google" id="friend_logo" />
					</form>
				</div>
			</c:otherwise>
		</c:choose>
		
			<div id="nav">
				<div id="logo">
					<a href="index.jsp"><img src="images/logo.jpg" href="index.jsp" alt="新闻中国" /></a>
				</div>
				<div id="a_b01"> <img src="images/a_b01.gif" alt="" /> </div>
				<!--mainnav end-->
			</div>
		</div>
		<div id="container">

			<jsp:include page="sideNews.jsp"></jsp:include>

			<div class="main">
				<div class="class_type"> <img src="images/class_type.gif" alt="新闻中心" /> </div>
				<div class="content">
					<ul class="class_date">
						<li id='class_month'>
							<a href="index"><b>全部</b></a>
							<c:forEach  items="${topiclist}"  var="topic">
								<a href="index?tid=${topic.tid}"><b>${topic.tname}</b></a>
							</c:forEach>		
						</li>
					</ul>
					<ul class="classlist">
						<c:forEach items="${page.getDatas()}" var="news" varStatus="status">
							<li>
								<a href="news?nid=${news.nid}">${news.ntitle}</a><span>${news.ncreateDate}</span></li>
							<c:if test="${status['count']%5==0}">
								<li class='space'></li>
							</c:if>
						</c:forEach>
					</ul>

					<p align='right'>
						<c:choose>
							<c:when test="${empty tid}">
								<c:if test="${page.pageNo>1}">
									<a href="index?pageNo=1">首页</a>
									<a href="index?pageNo=${page.pageNo-1}">上一页</a>
								</c:if>
								当前页数:[${page.pageNo}/${page.totalPages}]
								<c:if test="${page.pageNo<page.totalPages}">
									<a href="index?pageNo=${page.pageNo+1}">下一页</a>
									<a href="index?pageNo=${page.totalPages}">末页</a>
								</c:if>
							</c:when>
							<c:otherwise>
								<c:if test="${page.pageNo>1}">
									<a href="index?tid=${tid}&pageNo=1">首页</a>
									<a href="index?tid=${tid}&pageNo=${page.pageNo-1}">上一页</a>
								</c:if>
								当前页数:[${page.pageNo}/${page.totalPages}]
								<c:if test="${page.pageNo<page.totalPages}">
									<a href="index?tid=${tid}&pageNo=${page.pageNo+1}">下一页</a>
									<a href="index?tid=${tid}&pageNo=${page.totalPages}">末页</a>
								</c:if>
							</c:otherwise>
						</c:choose>
					</p>
				</div>
				<div class="picnews">
					<ul>
						<li>
							<a href="#"><img src="images/Picture1.jpg" width="249" alt="" /> </a>
							<a href="#">幻想中穿越时空</a>
						</li>
						<li>
							<a href="#"><img src="images/Picture2.jpg" width="249" alt="" /> </a>
							<a href="#">国庆多变的发型</a>
						</li>
						<li>
							<a href="#"><img src="images/Picture3.jpg" width="249" alt="" /> </a>
							<a href="#">新技术照亮都市</a>
						</li>
						<li>
							<a href="#"><img src="images/Picture4.jpg" width="249" alt="" /> </a>
							<a href="#">群星闪耀红地毯</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
		<div id="friend">
			<h1 class="friend_t"> <img src="images/friend_ico.gif" alt="合作伙伴" /> </h1>
			<div class="friend_list">
				<ul>
					<li>
						<a href="#">百度</a>
					</li>
					<li>
						<a href="#">谷歌</a>
					</li>
					<li>
						<a href="#">新浪</a>
					</li>
					<li>
						<a href="#">网易</a>
					</li>
					<li>
						<a href="#">搜狐</a>
					</li>
					<li>
						<a href="#">人人</a>
					</li>
					<li>
						<a href="#">中国政府网</a>
					</li>
				</ul>
			</div>
		</div>
		<div id="footer">
			<p class=""> 24小时客户服务热线：010-68988888 &#160;&#160;&#160;&#160;
				<a href="#">常见问题解答</a> &#160;&#160;&#160;&#160; 新闻热线：010-627488888 <br /> 文明办网文明上网举报电话：010-627488888 &#160;&#160;&#160;&#160; 举报邮箱：
				<a href="#">jubao@jb-aptech.com.cn</a>
			</p>
			<p class="copyright"> Copyright &copy; 1999-2009 News China gov, All Right Reserver <br /> 新闻中国 版权所有 </p>
		</div>
	</body>
</html>